This fixes some minor security problems and other bugs. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>