This Fixes #1039 : Changed the promise chaining