Fixed several JavaScript errors: moved bootstrap import after jquery import, added null check