closes #666