fixed reconcile bug, moved local var initialization to the top of code blocks