Fixing weird jquery issue on back end