Style fixes and unit tests for issue #319