First attempt at fixing #45.