fixed returnCode handling