Added assertions to some array methods to avoid false alarms from Clang static analyser.