ensure object exists before accessing .get