Fixes an issue where the last bar may have no or negative length, screwing up rhythm calculations. Fixes #7