A method to correct the amplitude distortions due to pile-up effects☆