bug fixes and small changes