fixed writing ports
nicer optiional cors feature: nicer, but still not nice