fixed ticket #22 and #25