Fix for #503

Added assert statement to catch wrong array size.

I also merged Cyrille's fix of the "start_shaders" example because I wasn't sure whether the tests would fail otherwise (but I presume this wasn't actually necessary).