db insertion checking