bug fixes, increase accuracy