Fixing bug arising when survey data is missing