Some "null" checks added