add exception safety