Fixed issue#1077, also added a test for issue#444 not to regress