possibly catch NPE
possibly catch NPE on the right level
replace Arrays.copyOf with method available in API <9