bug in mysql, enhancmenet of the static model functions