some changes in loadMatrix