fixing empty list check