working fixes tested on AWS and GCE