bugfix to address the indirect recursion of variables
some clean up and further steps towards the compatibility with c++03