Fixed a NULL pointer dereference and an infinite loop issue when parsing flags