fixed a bug with optional arguments ordering, added a test case for this bug