Fix decode for case when stdin is not present 

In cases when the environment doesn't have stdin,  for example when running test suites under jenkins your decode function fails.

Here is a fix for it.