Bugs fixed

Bugs found when using barpy with multiple type codes.