Ported new API fixes from FreeRDP