Improve error message on invalid movements

Based on commits by @psychotechnik