random bug fixes and testing