Fix double settings race condition

Change-Id: Ib47fbb6c4b4a69fc981a632cbd4c5e27621019c2