_getoptval now checks no. of options (more than 0) before getting value