fix clob reading and code cleanup