Fix bogus cast
Work around FileInputStream.skip() throwing a java.io.IOException: Invalid argument