Theoretical analyses on the role of Mg2+ ions in ribozyme reactions