Fixed expected length bug, but in a rather hacky way