Finally fixed jquery bug