Fixed #3027 and #3032.