added PurgeFunction fixes #2