fix couple errors when data is empty