Fixed library to work across browsers