Fix several bugs in aliases management