move a repeatedly used function to base.common
fix typo