Updated internal plugin from external plugin edit from EionRobb

Moved variable into if statement where it should be.