Fixed a bug with incorrect return value wrapping (OMS-432)