Fix kernel exception on return from direct mode