fix bugs and add print for read operation