fixed the length bug (for real this time)