Fixed bug that caused negative number sometimes in modulo arithmetic