fixes in checking commands return code