some security and small fixes