various changes to get working well in all browsers