fix for MB-744 and some changes suggested in andes code review