Incorporate pull request feedback

  - remove unneeded `setType(NoType)`, which was leftover from my
    first attempts to find this bug.
  - fix typo in error message
  - optimize imports

(cherry picked from commit 5c6ea29966fa80faae13892da50fc68ed1bf9ae7)