fixed closure problem with writeTo
alternate export method & compiled