fix stuff as mentioned in issue #32

@nathan2055 would you test this?