use length instead of deprecated size()