critical distance calculation fix
Merge pull request #2 from djdmbrwsk/master

critical distance calculation fix