js load function fixes