Api: several minor fixes