Fixed registry and nullpointer