bugfix for pre element replacement