Added better error handling for Credentials.java