the sizeof stuff was an early attempt at fixing the problem which didn't work. I didn't revert simply because it didn't break anything.