Fix the read/write the order was wrong