added return code verifications