bugfix the apply script