fix 'invalid hash' bug
rewrite TTLcheck code