fixed issues pointed out by daniel