Fixed the bug that if features is empty, it will call a null pointer.