added the new features into script export
fixed few bugs