Makes db insertion work as intended.