Fixed a bug in my A* alghorithm