fixed package unregistering and reorganized make rules