fixed problem with generating MAC code