fixed bug with optional parameters before callback