improve mysql replacements