adding readResolve and writeReplace methods