Bug-fixes and 64-bit compatibility