Reworked workaround function