fixed halflength error caused by whitespace