bug fixes, sorted errors