Fixed broken error propagation for promises