trying to fix IllegalStateException