I thought I could get it working but now my mind is blown!
I hard coded all the variables within the function to be the same every time it is run. However, it always runs correctly when saving manually and never returns correctly when saving automatically. The program is now defying the laws of logic in order to not work 
This is beyond reason(simplified):
PHP Code:
$var = 2;
if($var == 2)
{
return(true);
}
else
{
return(false):
}
Output from when I run manually: true
Output from when I run automatically: false