bug fixes in code