Improve error reporting for syntax errors on temp collections

Fixes #310.