fixes #847

@MartinKolarik @martypdx any thoughts before merging?