fixed delete database issue in general script and added tests