Fix action bugs. Add better test.