Fixed some variable issues