fix order of javascript methods