fixed memory leaks
Merge branch 'slomal'
minor bug fixes