Fixed #1024

Fixes #1024.