bug fixes, fine tuning