Mark some functions as static
Fix #9447: Don't crash when exporting to gallery