added checks around getting the size and attributes