checking for null everywhere