Fixed a bug in A*