mega logic error