proper fix for reported IllegalStateException