reordered some variable definition solving an order bug.