fixes #30; goodness...this code is so bad..