fixed -race problem