Build error bug fixed

Flag was set even program build fails.