BUG: Make more robust