logic error; god I'm dense today