fixes to improve speed