Null/undefined tests. Scope corrected to prevent undefined errors when failed to save