possible fix for illegal state exception