bug fixes, error detection