Added empty collection check.