improve return value and remove an unnecessary assert