fixed bug with singleton pattern