remove unnecessary if block