refactoring, fixing 64 bit