fixed looping issue