Fixes #1007

I was unable to reproduce the bug but this should fix whatever happened

#1007