Fixed bug with return code