Bug fixes in optimization from Fan Xu