fixed #511 for Mac Safari