Added workaround for double free