fix nullpointer exception and validate that domain with empty charset is working