changed logic for a better backward compatibility..