this fixes work of the checkDirection function in Firefox
Merge pull request #1215 from EvgenyAgafonchikov/master

this fixes work of the checkDirection function in Firefox