More bugfixes and a simple test