Fixed memory corruption error when saving data from PC
Moved so the RC input calculations are made in critical sones
Small change for better readability