Fix bug in sandbox frame management