Global variables weren't matching in global functions