Correcting null array bug