Validate object create flags beforehand
Calculate number of object types instead of using a constant
Move reference count checks one level up
Fix error handling in program_scheduler_create
Add session management to automatically expire external references