fixed the most terrible bug