added empty data check