added compatibility for FF and IE