fix race condition where return value is omitted