fixed fails with uint16 and uint32 sizes
added some debugging