Rearranged code to avoid dpkg error 100.