using reflection class to check returncodes