fixes mem allocation on A*