Small bugfixes in prefix handling