add length check to prevent oldIE errors. fixes most of #13.