added checks for hascontent flag