Removing seg-fault