Catch errors so cursor not stuck in wait mode