The global error minimization is a variational method for obtaining approximate analytical solutions to nonlinear oscillator equations which works as follows. Given an ordinary differential equation, a trial solution containing unknowns is selected. The method then converts the problem to an equivalent minimization problem by averaging the squared residual of the differential equation for the selected trial solution. Clearly, the method fails if the integral which defines the average is undefined or infinite for the selected trial. This is precisely the case for such non-periodic solutions as heteroclinic (front or kink) and some homoclinic (dark-solitons) solutions. Based on the fact that these types of solutions have vanishing velocity at infinity, we propose to remedy to this shortcoming of the method by averaging the product of the residual and the derivative of the trial solution. In this way, the method can apply for the approximation of all relevant type of solutions of nonlinear evolution equations. The approach is simple, straightforward and accurate as its original formulation. Its effectiveness is demonstrated using a Helmholtz-Duffing oscillator.