illegal state exception fixed