Fixing max size 0xFFFF issue - part 1
Fixing max size 0xFFFF issue - part 2