bug fixes and basic operation