Add created flag, fix unlocking code.