Fix exception in unknown commands that contain capital letters.

Fixes #1561. Removes an erroneous call to .lower() and adds regression tests.