why not replace the != with < and see if any error concerning that still remains