fixed bug where directions were reversed