Fix for bug #567

Fixes #567