fixed destroy functions
add api for script variable access