arithmetics bugfixes