fix bugs in security