template path changed to relative path
minor error handling