end_with api fix