fixed bugs uncoverd by a* recursion