refix 20
fixed another bug in #22
fixed #27
fixed #28