Fix prototypes function so that it doesn't skip the behaviors of the first level prototype

Refs #2417