bug fixes, cleaning