bug fixes and small style changes