fix #68, fix $sel problem when using special directions and add tests