Added length parameter top read and fetch and some safety checks.