Fix for SMOD with negative parameters