more fixes thanks to @jubianchi