Branch/reorder prototype chain

Double extra fix for `kernel.prototypes`; new tests. @eric79, @stevencarr please review.