fixed bugs in aftercast