fixed 2 errors with invalid length