fixed some redundant code