fixed return value checking