Added export defines and error callback