fixed singlton issue and preparing NDatabase support