Moved goal check test before node expansion