updating insert query and updating tests