Fixed potential illegalstateexception and memory leak. added basic support for domain records