bug fixes to mysql file locking