Minor bug fix when using jquery