bug fixes and stuff