fixed mod function to use % as specifier