Fixed replace functionality to do class deletion when the selector is just a class