simplify transformer, some bug fixes