Found better workaround for static variable crash