optimize the contents empty check