tests + fixed empty data check