Fixed return code check to check for correct value