Fatal error: Call to a member function getBackendModel() … during Customer Import

Magento Customer Import sometimes throws an error: "Fatal error: Call to a member function getBackendModel() on a non-object in app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php on line 411" If you encounter the same problem, you need to make sure that your custom customer attributes are assigned to a set. Otherwise the following code will remove your attributes from the array [...]