fix hard-coded number of directions