Fix for method that is not available in Java 5