fixed some variable issues