Fixup stuff

fixed up some bugs in libkit, and tidy'd up task.js's usages. 

I will apply the changes back to libkit, and use this pain to motivate my continued effort on improving the situation.