fixed for issue #18
fixed for issue #17
fixed for issue #19