Fixed security flaw and some other bugs