Fixed issues with content negotiation

Todo, update tests.