avoiding nullpointer for null parameters