fixed script that adds dynamic elements (now only adds them 1 time)