fixes #313 didnt manage to reproduce it in the test, but fixed