changed to work with jre 6