fix DEMAND table inserting bug