Fixed a bug that would crash on malformed input