Fix bugs with add/remove extension