changes to make it compatible with 64bit gcc