Possible NULL pointer dereferencing and wrong incremental statement fixed.