Avoid IllegalStateException