Bugfixes and more feature tests