fixed some basic bugs, pending re-test
curl