* prevent possible NULL dereference, add parameter check