fixes, optimization