Move version v to template
clean up mysql check code a little bit