fix bugs on 64-bit OS