Enables pickling abstract type, fixes #4 and #31