handle more complex case (but slowly)