Added validity check during importing from file