fixed part of issue #466 and issue #470