Fix bugs left after transition to 5.2