fix logic for static removal