Epimorphisms and subalgebras of finitely generated algebras