Applyed patches from Shiratsuchi-san (@kei-s). Thanks!