fix arithmetic error