added better method of os detection