Fixed a bug where the id was being overriden with null on insert