Fixes for bugzilla: 328, 331; JIRA: 223, 237