bugfixing and start check existanse of database