added encryption check + minor changes (bugs)