added check for zero elements in mesh read method