Bug in sql insert query