Fixed small typos.
Fixed issues with using ulong instead of size_t that would break only on 32bit.