major bugfixes after testing