bugfixes and new functions