some bug fixes and quick changes made to live version, before new refactored is ready