Filter empty commands without mutating the SQL
Improve error handling to allow reproduction of the original character data