Fixing some bugs, switching to inttypes