bug fixes and final sql dump