Fix possible error where rate is equal to None