fix level detection