Fix writeIntents