Added better error handling when columns are missing