Updated to run in Java 7
(cherry picked from commit 221b227)