updated macro error checking