Bug fix in return code