Remove dead codes
Fix mysql compatibility