fixed issue with doing entire database and tested on other dbs