Fix read operation
Add debugging information
Add asserts and read test