Bug fixes, changed to MySQL