Bug fixes

Fixes problems reported in 

https://github.com/dmwm/DDM/issues/41

https://github.com/dmwm/DDM/issues/42

The currently running code has been already patched to include those changes