huge bug fixes