bug fixes
added an SQL script