Fix hash redirect logic. Fixes #158