Use throwIO instead of throw

(this gives better ordering guarantees)