fixed error http://stackoverflow.com/q/16664248/562769