Bug fixes for firefox

#5 and #6