fix bug with return code passing