Fixed bugs in publishing and created several tests