handle bug http://stackoverflow.com/a/17751930/802421