added spinner but it doesn't work on first click only second and after