check for nil before checking size