Improve empty data check