Error margin being applied at the wrong time