Some fixes for improve speed