4018 negative currency rebase

Re-doing pr #4172  with the necessary rebasing.

Fix for #4018