new function for writing disk images