modified cast from (int) to (Integer) for (hopefully) jdk6 compatibility