fixed IllegalStateException error