Fix issue #568, #575 and remove TypeError for None when checkMemory.
Tidy code.
Update hash for data test
Resolve failed tests due to last change.