Fix an exception thrown when removing the last realmlist