Minor fix in return value checking