Bugfixes

See commit messages for details. Just a couple bugs we've encountered while using ECD