Fixed bug number 478.
Fixed github issues 478 and 476.