Fixed null bug when no id was provided