Fixes bug where callback could be called before class initialisation has finished.