Added safe check in AeshInputStream