ISPN-1954 and ISPN-2684

This fixes ISPN-1954 and ISPN-2684. I put both in one pull-req as ISPN1954 depends on ISPN-2684