some fixes to improve code's understandableness