Pull request from @PEMapModder, fixes #2

Read the diff yourself and find me on IRC or forums if you have any questions. Don't ask here. This should auto-close #2.