used isset instead of comparing to null