DynamicList: fixed NullPointerException on iterating over empty list,
minor performance improvements.