Be more conservative about moving @imports to the top.

Closes #843