fixed image build logic