Fixed Bugs in Opt