Fix minor bug in evaluation of direction