bugfix gallery IllegalStateException