improve JS save API