Fixed issues (#1024, #1081)