fixes #476
slight changes to #476