fixed #1620: Check return value.