Fixing the bug..

Locking over instance when instance is null will result in NullPointer.
Fixed by setting the synchronised block over the Class.