arithmetic and bugfixes