Syntax error on promise chain fixed