fixes for BZ issues 1015513 and 1015505
Merge pull request #19 from EricWittmann/gadget-BZs-2013-10-05

fixes for BZ issues 1015513 and 1015505