Additional tests and bugfix