Fix some bugs introduced when converting to RectD