BUG: prevent divide by 0