added checkreturn and logoutput