fixed division by 0 if table size is empty