fix bug and add test for qualifier direction logic