Use extend instead of singleton method

Singleton method disables Marshal.dump.