prevent php warning when using {{@index}} or {{@first}} or {{@last}} or {{@key}}
fix unit tests