fixing error when length of shelf is zero