Issue #508

Fixes for #508