fixed improperly defined variables/refs
[completed: 116]