ported revision 8a8322ca to other classes