fixed my broken logic