Fixed bug where undefined callback is called