Fixing various issues with long prefixes
Adding tests for long prefixes