fix for d3.mouse crashing

This should fix the bug with d3.mouse in #82

Tested the fix with our visualisations and it's working on our end. Maybe test with other visualisations as well?