add try/catch for input
corrected stdin read