better handling of malformed statement