add retcode check