fix dying when using traits, remove warning on undefined index