clean out some junk
replace manual buffer copy with System.arraycopy().