Bug fixes and code style improvements in LOF.