Fixed INSERT INTO bug and added test for the same