minor fixes because of return value optimization