remove and return
fixes #5769