Small fixes to give a temporary id when id is null