fix this logic