fix infinite loop and better debug messages

* iterator on freeObjectTable loop was 16 bits length, the object table
size could be 65535, resulting in an infinite loop because 65534 + 1 = 0
with 16 bits unsigned integer.
* fix type of object table size
* better debugging messages
adding file causing infinite loop

caused infinite loop because integer overflow