Fixes #36 with a test to avoid anything like that to happen again