Initial work on locating the portable bytearray bug
Fix #1096

Fixes an issue with portable serialization resulting in different byte arrays. The cause
was a bytearray which wasn't cleaned correctly.
Merged pull #1100. Added some complex portables to test.