Fixed bug for conditional

If function was missing an end