Fix for Issue #461 and #583