Some improvments and security fixs