bugfixes and security improvements