better error logging in engine