fixing carousel logic