fixing issue #26 and issue #27