fixes #402, #319 inlcuding PR #262
fixes #402, #319 including PR #262
merged development branch
merge