fix some type inconsistencies using named return values