Fixed Issue #365. Added test
Merge branch 'Ofir-Purple-dev' into dev