Fix digital read and write