Fixed #1210 based on #1313.