fixes and optims