64-bit safer
ugly fix to solve segfaults on 64-bit platforms.