fixed value used before assignment error