fixes to various parts of 4 and 5
merge