Some fixes to how to write promises