fixed bugs in new attachment system