Tried to make the patch more robust