fixed #326 #331 #320