Prevent IllegalStateException