Hopefully fixed a bug

Certain variables were not behaving correctly