[BUG_FIX] make sure that main elements are registered prior to their subelements