Don't modify interim return value.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Return actual payload ID in case of a dynamic payload

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>