fixing open query to look for null instead of non-existent