Contains fixes for the issues #253, #258

contains fixes for #253, #258