Fixed bugs #2202 and #2203.