logic error sometimes reulted in a 0, fixed for now