Fix horrible bug that has been around for exactly 2 months and in that time has broken all advanced scripts and molested countless kittens.