#162 fixed query permalink functionality