Fixed #12 for real this time, had still some bugs