(I have edited your question to avoid the screen dumps; please try to use text, it makes for a much better experience).
The first one is a true brown paper bag issue. No idea how that slipped past the zillions of tests. Now fixed in github master. Thanks for reporting this.
To collect factors, as in your second problem, use
ex:= A**3 A**2;