fixing data length problem