Corrected logic error.