Use proper return code
Fix warnings under gcc