Added null check for $id