bugfixes and functionality