bug fixing for multiple inserts