fixed bug in unclear part of the code