Added error checking to Partiton builder to prevent possible npes later on.