remove build-prefix only if necessary