Added fix for black rectangle bug