Various fixes in Foundation and KKObjects