Fixed issues with the insert statement