fixed bugs in first A star algorithm