Fixes for 28, 29 and 31. Some other small fixes.