fixed illegalstate error