Alain,

Can you try declare the variables Invert and Side as BYTE?
(Just a quick test).

Best regards,

Luciano