Fix critical bugs for build

- fix optimizers

- fix Image class

- build sources