fixed alignment code