fixed a bug in handling options