Fix issue #577

Based on our conversation regarding issue #577