replaces UnsupportedOperationException by IllegalStateException
replaces long constructor call by valueOf