Fix bug with pathfinding when compiling with -O3

This commit fixes issue #164. Thanks to @dalkon for the patch.
More items from 10.2/10.3
small fix
Merge pull request #404 from ninjahopparn/master

More items from 10.2/10.3