Moved source resolution out of if statement.