Fixed writing to h5 problem