mapping now works with serialization. Also added unit test for it.