more robust method