fix import script
various stuff for embedding into wp