Fixed issues #58 and #69

Hi,

there are two commits that you might like :
 
the two commits f34e226 and fd11dee