Fixed some issue with the length being messed up