Some improvments and security fix